	version 11
	/* THE FILE GENERATES VARIABLE TAXRATE ACCORDING TO TAX SCHEDULE OF PAKISTAN */
	set more off
	matrix input tax_rates=(0.5 ,1   ,   2,  3,  4,  5,7.5,10 ,12.5,15,19,21  ,  25, 0, 0, 0  ,    0,   0, 0, 0\						///
							0.25,0.5 ,0.75,1.5,2.5,3.5,4.5,6  , 7.5, 9,10,11  ,12.5,14,15,16  , 17.5,18.5,19,20\						///	
							0.5 ,0.75,1.5 ,2.5,3.5,4.5,6  ,7.5,   9,10,11,12.5,	 14,15,16,17.5,	18.5,  19,20, 0\						///
							1.5 ,2.5,3.5,4.5,6  ,7.5,   9,10,11,12.5,	 14,15,16,17.5,	18.5,  20, 0,0,0,0)
	gen taxrate_we=0
	local i=1
	foreach z in 150 200 250 300 350 400 500 600 700 850 950 1050 1200 1500 1700 2000 3150 3700 4450 8400 {
			replace taxrate_we=tax_rates[2,`i'] if taxableinc > (`z'*1000) & (year==2006 | year==2007)
			local i=`i'+1
	}
	local i=1
	foreach z in 180 250 350 400 450 550 650 750 900 1050 1200 1450 1700 1950 2250 2850 3550 4550 8650 {
			replace taxrate_we=tax_rates[3,`i'] if taxableinc > (`z'*1000) & (year==2008  | year==2009 | year==2010)
			local i=`i'+1
	}
	local i=1
	foreach z in 350 400 450 550 650 750 900 1050 1200 1450 1700 1950 2250 2850 3550 4550 {
			replace taxrate_we=tax_rates[4,`i'] if taxableinc > (`z'*1000) & year==2011
			local i=`i'+1
	}
	replace  taxrate_we=0.5  if taxableinc >200000  & taxableinc<=250000  & year==2009
	replace  taxrate_we=0  if taxableinc <= 200000  & year==2009
	replace  taxrate_we=0  if taxableinc <= 300000  & year==2010
	replace  taxrate_we=0  if taxableinc <= 350000  & year==2011
	replace taxrate_we=. if taxableinc==.
	replace taxrate_we=0 if taxableinc<=0

